﻿using System;
using System.Windows.Forms;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Pipeline.Design;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;

namespace Table_Storage_Component
{
    class ComponentUI : IDtsComponentUI
    {
        #region Private Variables
        private IDTSComponentMetaData100 _dtsComponentMetaData;
        private IServiceProvider _serviceProvider;
        #endregion

        public void Help(System.Windows.Forms.IWin32Window parentWindow)
        {
        }
        public void New(System.Windows.Forms.IWin32Window parentWindow)
        {
            
        }
        public void Delete(System.Windows.Forms.IWin32Window parentWindow)
        {
        }
        public bool Edit(System.Windows.Forms.IWin32Window parentWindow, Variables vars, Connections cons)
        {
            // Create and display the form for the user interface.
            ComponentUIForm componentEditor = new ComponentUIForm(cons, vars, _dtsComponentMetaData, _serviceProvider);

            DialogResult result = componentEditor.ShowDialog(parentWindow);

            if (result == DialogResult.OK)
                return true;

            return false;
        }
        public void Initialize(IDTSComponentMetaData100 dtsComponentMetadata, IServiceProvider serviceProvider)
        {
            // Store the component metadata.
            _dtsComponentMetaData = dtsComponentMetadata;
            _serviceProvider = serviceProvider;
        }
    }
}
